<%--
  Date: 2017/7/10
  Time: 16:05
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/view/common/conmont.jspf" %>
<html>
<head>

    <title>新增商品</title>
    <script type="text/javascript">
        $(function() {
            $("[name='goodsName']").validatebox({
                required : true,
                missingMessage : '请填写商品名称！'
            });
            $("[name='goodsId']").validatebox({
                required : true,
                missingMessage : '请填写商品编号！'
            });
            $("[name='goodsBuyPrice']").validatebox({
                required : true,
                missingMessage : '请填写商品进价！'
            });
            //禁用验证
            $("#ff").form("disableValidation");

         $("#btn").click(function() {
                $("#ff").form("enableValidation");
                if ($("#ff").form("validate")) {
//                  表单参数自动序列化 提交
                    $('#ff').form('submit', {
                        url : '${webRoot}/goods/insertGoods',
                        onSubmit : function() {
                            return true;
                        },
                        success : function(count) {
                            //可以定义为对应消息框
                            if(count>0){
                                alert("成功");
                                parent.$("#win").window("close");
                                getTabWindow().$("#dg").datagrid("reload");
                            }else {
                                alert("插入失败")
                            }

                        }
                    });

                }else {
                    alert("请完成输入");
                }

            });

        });
    </script>
</head>
<body>
<form id="ff" method="post">
    <div>
        <label for="goodsId">商品编号:</label> <input type="text" id="goodsId" name="goodsId" />
    </div>
    <div>
        <label for="goodsName">商品名称:</label> <input type="text" id="goodsName" name="goodsName" />
    </div>
    <div>
        <label for="goodsType">商品类型:</label> <input type="text"
                                                    name="goodsType" />
    </div>
    <div>
        <label for="goodsColor">商品颜色:</label> <input type="text" name="goodsColor"/>
    </div>
    <div>
        <label for="goodsStore">库存下限:</label> <input type="text" name="goodsStore"/>
    </div>
    <div>
        <label for="goodsBuyPrice">进价:</label> <input type="text" name="goodsBuyPrice"/>
    </div>

    <div>
        <label for="goodsProducer">厂商:</label> <input type="text" name="goodsProducer"/>
    </div>
    <div>
        <label for="supType">供应商类型：</label>
        <select id="cc" class="easyui-combobox" name="supType" style="width:200px;">
            <c:forEach items="${applicationScope.sysParam.supType}" var="supType">
                <option value="${supType.key}">${supType.value}</option>
            </c:forEach>
        </select>
    </div>
    <div>
        <label for="goodsRemark">备注:</label> <textarea name="goodsRemark"></textarea>
    </div>
    <div>
        <input id="btn" type="button" value="提交" />
    </div>
</form>


</body>
</html>
